//
//  RootViewController.m
//  YouMin_iOS
//
//  Created by lanou3g on 15/12/9.
//  Copyright © 2015年 wey. All rights reserved.
//

#import "RootViewController.h"
#import "Reachability.h"
@interface RootViewController ()
@property (nonatomic, strong) Reachability *ReachabilityMgr;
@end

@implementation RootViewController
- (Reachability *)ReachabilityMgr {
    
    if (!_ReachabilityMgr) {
        _ReachabilityMgr = [Reachability reachabilityWithHostName:@"www.baidu.com"];
    }
    return _ReachabilityMgr;
}

- (void)awakeFromNib {
    
    self.parallaxEnabled = NO;
    self.scaleContentView = YES;
    self.contentViewScaleValue = 0.95;
    self.scaleMenuView = NO;
    self.contentViewShadowEnabled = YES;
    self.contentViewShadowRadius = 4.5;
    self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"tabBarVC"];
    self.leftMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"leftMenuVC"];
}


- (void)viewDidLoad {
    [super viewDidLoad];
    [self checkNetWork];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}


- (void)checkNetWork {
    
    MBProgressHUD *hud = [Tools creatHUD:self.view];
    hud.mode = MBProgressHUDModeText;
    
    NSString *alter = @"";
    
    switch (self.ReachabilityMgr.currentReachabilityStatus) {
        case NotReachable:
            alter = @"请检查你的网络连接";
            break;
        case ReachableViaWiFi:
            alter = @"当前为wifi环境";
            break;
        case ReachableViaWWAN:
            alter = @"当前为3G/4G网络";
            break;
            
        default:
            break;
    }
    
    hud.labelText  = alter;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [hud removeFromSuperview];
    });
    
    
    
}



@end
